import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    ellipsis: true,
    resizable: true,
  },
  {
    title: '类型',
    dataIndex: 'kindDesc',
    ellipsis: true,
    resizable: true,
  },
  {
    title: '日期字段',
    dataIndex: 'dateField',
    ellipsis: true,
    resizable: true,
  },
  {
    title: '提前',
    dataIndex: 'typeName',
    ellipsis: true,
    resizable: true,
    customRender: ({ record }) => {
      return `${record.aheadDay || 0}天 ${record.aheadHour || 0}小时 ${
        record.aheadMinute || 0
      }分钟`;
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'what',
    label: '名称',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    required: true,
    colProps: {
      span: 24,
    },
  },
  {
    field: 'roleDescs',
    label: '角色',
    component: 'Input',
    colProps: {
      span: 24,
    },
    slot: 'roleDescs',
  },
  {
    field: 'userRealNames',
    label: '用户',
    component: 'Input',
    colProps: {
      span: 24,
    },
    slot: 'userRealNames',
  },
  {
    field: 'tableName',
    label: '表名',
    component: 'Select',
    required: true,
    colProps: {
      span: 24,
    },
    componentProps: {
      options: [],
    },
  },
  {
    field: 'dateField',
    label: '日期字段',
    component: 'Select',
    required: true,
    colProps: {
      span: 24,
    },
    componentProps: {
      options: [],
    },
    ifShow: ({ values }) => values.kind <= 1,
  },
  {
    field: 'userField',
    label: '表单中的用户',
    component: 'Select',
    colProps: {
      span: 24,
    },
    componentProps: {
      options: [],
    },
  },
  {
    field: 'filter',
    label: '条件',
    component: 'Select',
    colProps: {
      span: 24,
    },
    slot: 'filter',
  },
  {
    field: 'kind',
    label: '提示方式',
    component: 'Select',
    required: true,
    colProps: {
      span: 24,
    },
    defaultValue: '0',
    componentProps: {
      options: [
        {
          label: '到期提醒',
          value: '0',
        },
        {
          label: '周年提醒',
          value: '1',
        },
        {
          label: '添加后提醒',
          value: '2',
        },
        {
          label: '编辑后提醒',
          value: '3',
        },
        {
          label: '删除后提醒',
          value: '4',
        },
        {
          label: '查看后提醒',
          value: '5',
        },
      ],
    },
  },
  {
    field: 'actionType',
    label: '动作',
    component: 'Select',
    colProps: {
      span: 24,
    },
    defaultValue: 'module_show',
    componentProps: {
      options: [
        {
          label: '查看记录',
          value: 'module_show',
        },
        {
          label: '编辑记录',
          value: 'module_edit',
        },
      ],
    },
    ifShow: ({ values }) => values.kind > 1,
  },
  {
    field: 'aheadDay',
    label: '提前时间',
    component: 'Select',
    colProps: {
      span: 24,
    },
    slot: 'aheadDay',
    ifShow: ({ values }) => values.kind <= 1,
  },
  {
    field: 'title',
    label: '标题',
    component: 'Input',
    required: true,
    colProps: {
      span: 24,
    },
    slot: 'title',
  },
  {
    field: 'content',
    label: '内容',
    component: 'Select',
    colProps: {
      span: 24,
    },
    slot: 'content',
  },
  {
    field: 'way',
    label: '方式',
    component: 'Input',
    colProps: {
      span: 24,
    },
    slot: 'way',
  },
];
